Improve C# WASM Runtime Binding Loading and Logging - #153
Closed
himanshigaba22 wants to merge 1 commit into
Closed
Conversation
…logging, and partial DrawCircle binding
himanshigaba22
temporarily deployed
to
static-site
July 25, 2026 10:04 — with
GitHub Actions
Inactive
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Follow-up fixes for the C# WASM runtime used in SplashKit Online, focused on
removing unsafe binding logic, improving debuggability, and extending partial
C# binding support.
Issues addressed
eval()usage inmain.jsprocess_eventshad no fallback if the binding was ever missingDrawCirclehad no C# binding at all — filtered out bybindingGenerator.pybecause it takes a
colorparameter, which isn't supported by JSImport'ssource-generated marshalling
Changes
CSharpWasmExpo/main.jseval(name)with a directglobalThis[name]lookup — avoids CSPunsafe-evalrestrictions and removes arbitrary code executionprocess_eventsso a missing binding degradesgracefully instead of crashing
format
reportError,not just logged to console
CSharpWasm/SplashKitBindings.Generated.csDrawCircleandRgbaColor, representingcolour as a packed
int(RGBA) sinceJSImportdoesn't support marshallingarbitrary structs like SplashKit's
colortypebuildAndCopy.sh) after correcting an initialuintreturn type toint(uint isn't marshallable — SYSLIB1072)Known follow-up (not fixed here)
While testing, found that
OpenWindowhas no C# binding either — same rootcause (
Windowis in the generator'sunsupported_typesfilter). The C#backend currently has no way to explicitly open a window through bindings.
Worth its own follow-up item.
Testing
Built and ran locally via
CSharpWasm/buildAndCopy.sh+npm run server.Confirmed in browser DevTools console:
[SKO C# Runtime] Resolved 777/908 SplashKit bindings.[SKO C# Runtime] .NET WASM runtime ready.eval/CSP-related errorsDrawCircle/RgbaColorcompile and execute without error via a testC# program (using
ClearScreen()in place ofOpenWindowdue to thegap noted above)